import requests
import json

headers = {
    "Content-Type": "application/json; charset=UTF-8",
    "Referer": "多多进宝",
    "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36",
}
url = "http://jinbao.pinduoduo.com/network/api/common/goodsList"
pyload = {"keyword": "", "sortType": 0, "withCoupon": 0,
          "categoryId": 16, "pageNumber": 1, "pageSize": 60}
response = requests.post(url, data=json.dumps(pyload), headers=headers).text
print(response)

senddata = {}
senddata['flag'] = 1
senddata['content'] = 'mm'
resp = requests.post("http://localhost:5000", data=str(senddata).encode('utf-8'),
                     headers={'content-type': 'application/json'})
print(json.loads(resp.text)['result'])

# 请求地址
url = "https://api.global.net/datastore/v1/tracks/"+trackId+"?location=12}"
# 发送get请求
r = requests.get(url)
# 获取返回的json数据

print(r.json())
